<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Dashboard extends CI_Controller {

	var $data;

	public function __construct(){
		parent::__construct();

		$this->load->model('account');

		if(!$this->account->validate_cookie()){
			$this->session->set_flashdata('error', 'Anda tidak mempunyai akses ke halaman ini');
			header('location: '.site_url().'/login');
		}else{

			$this->data['cookie'] = $this->account->get_cookie();
		}
	}

	public function index(){

		$this->data['page']  = 'home';
		$this->data['title'] = 'Dashboard';
		$this->load->view('dashboard', $this->data);

	}

	public function logout(){

		$this->account->do_logout();
		header('location: '.site_url().'/login');
	}


}